Portable electronic device supporting multi-protocols

ABSTRACT

A portable electronic device includes a storing unit for storing different types of communication protocols, a priority order setting unit for setting a priority order for the different types of communication protocols stored in the storing unit, a selecting unit for selecting a predetermined communication protocol from the different types of communication protocols on the basis of the priority order set by the priority order setting unit, and a communicating unit for performing communication using the predetermined communication protocol selected by the selecting unit.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a portable electronic device such as anIC card having a function of supporting two or more communicationprotocols.

2. Description of the Related Art

An IC card is available as a conventional portable recording medium.This IC card comprises a ROM for storing control programs, a data memoryfor storing various types of data, a CPU for performing various controloperations on the basis of the control programs stored in the ROM, andcontacts brought into electrical contact with an external device toexchange data therewith. A communication protocol for performing datacommunication with the external device is stored in the ROM.

In recent years, IC cards are used in a variety of applications. The ICcards must exchange data with various external devices such as bankterminals and credit terminals at different positions. For this reason,a plurality of communication protocols are prepared in advance, and adesired communication protocol is appropriately selected. Demand hasarisen for an IC card capable of accurately performing communicationwith external devices having different types of communication protocols.

In a system including this IC card and external devices, a desiredcommunication protocol used at the time of data communication in thesystem must be selected and designated at the start time of the system.In any case, even a frequently used communication protocol cannot beused without performing predetermined procedures for designating thecommunication protocol.

As described above, in a conventional portable electronic devicecompatible with a plurality of protocols, a user must designate acommunication protocol prior to data communication. Data communicationcannot therefore be started at the start time of the system, resultingin inconvenience.

SUMMARY OF THE INVENTION

It is, therefore, an object of the present invention to provide aportable electronic device compatible with a plurality of protocols andcapable of starting data communication at the start time of a system.

In order to achieve the above object of the present invention, there isprovided a portable electronic device comprising means for storingdifferent types of communication protocols, priority order setting meansfor setting a priority order for the different types of communicationprotocols stored in the storing means, means for selecting apredetermined communication protocol from the different types ofcommunication protocols on the basis of the priority order set by thepriority order setting means, and communicating means for performingcommunication using the predetermined communication protocol selected bythe selecting means.

A priority order is preset for the plurality of communication protocolsstored in the storing means of the electronic portable device. At thestart time of a system, a communication protocol having the highestpriority is automatically selected. Consequently, when the communicationprotocol having the highest priority is used, data communication can bestarted simultaneously with the start of the system.

Additional objects and advantages of the invention will be set forth inthe description which follows, and in part will be obvious from thedescription, or may be learned by practice of the invention. The objectsand advantages of the invention may be realized and obtained by means ofthe instrumentalities and combinations particularly pointed out in theappended claims.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are incorporated in and constitute apart of the specification, illustrate presently preferred embodiments ofthe invention, and together with the general description given above andthe detailed description of the preferred embodiments given below, serveto explain the principles of the invention.

FIG. 1 is a block diagram showing an internal arrangement of an IC cardaccording to an embodiment of the present invention;

FIGS. 2A and 2B are flow charts for explaining processing flows forperforming data communication with the IC card shown in FIG. 1;

FIG. 3 is a flow chart for explaining an operation of an external deviceshown in FIG. 1;

FIG. 4 is a flow chart for explaining a processing flow for updatinginitial data in the IC card shown in FIG. 1; and

FIG. 5 is a view showing a format of an initial data updating command.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

An IC card according to an embodiment of the present invention will bedescribed below with reference to the accompanying drawings.

An internal arrangement of IC card 1 according to this embodiment willbe described with reference to FIG. 1. IC card 1 incorporates mask ROM 2for storing control programs, data memory 3 constituted by an EEPROMand/or a battery backed-up RAM for storing various types of data, CPU 4for performing various control operations on the basis of the contentsof the control programs in mask ROM 2, contact portion 5 brought intoelectrical contact with external device 7 such as a reader/writer toperform data exchange with external device 7, and communication I/Ocircuit 6 for communicating with external device 7 with a predeterminedcommunication protocol at a predetermined baud rate.

Two different protocols A and B for performing communication are storedin mask ROM 2. When IC card 1 is to communicate with external device 7,CPU 4 performs communication control in accordance with protocol A or Bstored in mask ROM 2. RAM 40 is incorporated in CPU 4.

An operation for causing IC card 1 to perform data communication withexternal device (reader/writer) 7 will be described with reference toFIGS. 2A to 5.

CPU 4 reads out data at address $0000 of data memory 3 to determinewhether the upper nibble of this readout data is 0_(H) (step ST1) where"H" indicate hexadecimal notation. An asterisk of 0*H in step ST1indicates a wildcard character which can be substituted with anarbitrary number.

If the upper nibble of address $0000 is 0_(H), CPU 4 determines that ICcard 1 supports only protocol A or B (to be referred to as case 1hereinafter), and processing starting from step ST2 to be describedlater is performed.

If the upper nibble of the data at address $0000 of data memory 3 is avalue except for 0_(H), CPU 4 determines that IC card 1 supports twodifferent protocols A and B and that protocol A or B can be designatedby an external device (to be referred to as case 2 hereinafter). In thiscase, processing starting from step ST14 to be described later isperformed.

Note that an address in step ST1 may be any value other than $0000 andmay be exemplified by $FFFF. In this case, F*H is checked in step ST1,and *FH is checked in step ST2 or ST14.

Processing under the condition that IC card 1 supports either protocol Aor B, i.e., case 1, will be described with reference to FIG. 2A. IC card1 receives a power and a clock signal from external device 7 and iscontrolled by CPU 4.

Prior to data communication, a reset signal is supplied from externaldevice 7 to CPU 4. When this reset signal is disabled, initial datacalled "Answer to Reset" (ANS-TO-RESET) is output from CPU 4 in IC card1 to external device 7. The "Answer to Reset" information includes datadefining the type of communication protocol supported by IC card 1.External device 7 receives "Answer to Reset" information and checks thecommunication protocol used with IC card 1 (cf. ISO/IEC DIS 7816-3).

FIG. 3 is a flow chart for explaining how external device 7 communicateswith IC card 1.

when the "Answer to Reset" information is output from IC card 1 (stepsST3 and ST6 in FIG. 2A or steps ST15 and ST21 in FIG. 2B), externaldevice 7 receives this "Answer to Reset" information (step ST201). Aprotocol used until the "Answer to Reset" information is output isstandardized in accordance with ISO standards. This "Answer to Reset"information includes data representing the protocol supported by IC card1.

External device (e.g., a bank terminal or a credit terminal) 7 supportsone protocol. A CPU (not shown) in external device 7 checks (step ST202)on the basis of the input "Answer to Reset" information whether its ownprotocol is supported by IC card 1.

If the protocol of external device 7 is supported by IC card 1 (YES instep ST202), external device 7 outputs information for selecting its ownprotocol (step ST203) and then outputs various commands to IC card 1(step ST204). If the protocol of external device 7 is not supported byIC card 1 (NO in step ST202), error information is output (step ST205).

That is, on the basis of protocol selection information from externaldevice 7, IC card 1 sends "Answer to Reset" information including thedata representing the protocol supported by this IC card 1. Therefore,one of the plurality of protocols supported by this IC card is selectedby external device 7.

IC card 1 can correspond to different types of protocols supported bydifferent types of external devices 7 in the arrangement of FIG. 1 andthe processing operations of FIGS. 2A and 2B. Each external device 7automatically switches and selects one of the protocols from IC card 1which supports multi-protocols.

Protocol switching is mainly assumed as switching between the IC cardprotocol and basic procedures of processing performed using an IC card.A semiduplex block transmission scheme is used as the IC card protocol.

Referring back to FIG. 2A, CPU 4 in IC card 1 reads out data at address$0000 of data memory 3 before CPU 4 outputs the "Answer to Reset"information to external device 7. After CPU 4 determines (step ST1) thatthe upper nibble of the data is 0H, CPU 4 determines (step ST2) whetherthe lower nibble of the data is 0_(H).

If the lower nibble of address $0000 is set to be 0_(H), CPU 4 outputsthe "Answer to Reset" information representing that the "communicationprotocol is protocol A" (step ST3). In protocol A, control transits to astate for waiting a command from external device 7 (step ST4). Thecommand waiting state is maintained in protocol A until any commandinput is entered (step ST5).

If the lower nibble at address $0000 is any value other than 0_(H) instep ST2, CPU 4 outputs the "Answer to Reset" information representingthat the "communication protocol is protocol B" (step ST6). CPU 4 isthen set in an external command waiting state in protocol B (step ST7).In this case, CPU 4 continues the command waiting state in protocol Buntil any command input is entered (step ST8).

when CPU 4 receives a command (cf. step ST204 in FIG. 3) from externaldevice 7, CPU 4 determines (step ST9) whether this command is a datacommunication end command. If this command is determined not to be adata communication end command, processing corresponding to thedetermined command is performed (step ST10). CPU 4 checks the value ofaddress $0000 in data memory 3 to check if the lower nibble of the datais 0_(H) (step ST11).

If the lower nibble of address $0000 is 0_(H) in step ST11, a processingresult is output to the external device in protocol A (ST12), and CPU 4returns to the command waiting state in protocol A in step ST3 describedabove. If the lower nibble of address $0000 is a value other than 0_(H)in step ST11, a processing result is output to the external device inprotocol B (step ST13). CPU 4 then returns to the command waiting statein protocol B in step ST6.

In step ST9, if the received command is the data communication endcommand, CPU 4 ends data communication processing.

Data communication processing of IC card 1 under the condition that ICcard 1 supports two different communication protocols and one of themcan be designated by the external device, i.e., case 2, will bedescribed with reference to FIG. 2B.

IC card 1 receives external power and an external clock signal to setCPU 4 operative, as described above. After the reset signal is disabled,CPU 4 reads out data at address $0000 and determines (step ST1) whetherthe upper nibble of the data at address $0000 is any value other than0_(H). CPU 4 determines (step ST14) whether the lower nibble of the datais 0_(H).

In this case, if the lower nibble of the data at address $0000 is 0_(H),CPU 4 outputs "Answer to Reset" information representing protocol A as aprotocol having the first priority (to be referred to as the firstprotocol hereinafter) and protocol B as a protocol having the secondpriority (to be referred to as the second protocol hereinafter) toexternal device 7 (step ST15). Data "00H" is stored at a specificaddress of RAM 40 in CPU 4 (step ST16), and CPU 4 is set in protocol Ain a state for receiving a command from the external device (step ST17).

When CPU 4 receives any data in the command waiting state in protocol A,CPU 4 determines (step ST18) whether the input data is PTS (ProtocolType Selection) data for selecting a communication protocol.

If the received data is the protocol type selection data (PTS data), CPU4 determines (step ST19) whether the PTS data is data for designatingprotocol B. If so, data "01H" is stored at a specific address of the RAMin CPU 4 (step ST22), and CPU 4 is set in a command waiting state withprotocol B in step ST23 (to be described later).

If the received data is not PTS data in step ST18 or the PTS data is notthe PTS data for designating protocol B in step ST19, CPU 4 determines(step ST20) whether the received data is a command. If NO in step ST20,CPU 4 is set in a command waiting state in protocol A (step ST17).

In step ST14, if the lower nibble of the data at address $0000 is avalue other than 0_(H), CPU 4 outputs to external device 7 "Answer toReset" information representing protocol B as the first protocol andprotocol A as the second protocol (step ST21), and data "01H" is storedat a specific address of the RAM in CPU 4 (step ST22). CPU 4 is then setin an external command waiting state in protocol B (step ST23).

When CPU 4 receives any data in the command waiting state in protocol B,CPU 4 determines (step ST24) whether the data is protocol type selectiondata (PTS data). If the received data is determined to be PTS data, CPU4 determines (step ST25) whether the PTS data is data for designatingprotocol A. If YES in step ST9.5, data "00_(H) "is stored at a specificaddress of RAM 40 in CPU 4 (step ST16). CPU 4 is set in the commandwaiting state in protocol A in step ST17 described above.

If the received data is not PTS data in step ST24 or the PTS data is notPTS data for designating protocol A in step ST25, CPU 4 determines (stepST26) whether the subsequently received data is a command. If NO in stepST26, CPU 4 is set in the command waiting state in protocol B again(step ST23).

When CPU 4 determines in steps ST20 and ST26 that the data received fromexternal device 7 is a command, CPU 4 determines (step ST27) whether thecommand is a data communication end command. If NO in step ST27,processing of this command is performed (step ST28). The content of thespecific address of RAM 40 incorporated in CPU 4 is checked (step ST29).

If the content of the specific address of RAM 40 is 00_(H), a commandprocessing result is output in protocol A (step ST30). CPU 4 is set inthe command waiting state in protocol A in step ST17 described above. Ifthe content of the specific address of RAM 40 is not 00_(H), a commandprocessing result is output in protocol B (step ST31). CPU 4 is then setin the command waiting state in protocol B in step ST23 described above.

If CPU 4 determines in step ST27 that the received command is a datacommunication end command, data communication processing is ended.

A communication baud rate (9,600 bps, 4,800 bps, or 1,200 bps) withexternal device 7 can be set simultaneously when a protocol is set insteps ST4, ST7, ST15, and ST21.

Hardware of a variable baud rate (multi-baud rate) can be performed bychanging the frequency of a communication clock in I/O circuit 6.

When data communication is to be performed between IC card 1 andexternal device 7, CPU 4 in IC card 1 refers to the data content ataddress $0000 of data memory 3 as initial data (step ST1) and determineswhether protocol A or B is used in data communication on the basis ofthe initial data. In order to change the communication protocol, theinitial data (0*H) in memory 3 must be updated. This processing will bedescribed with reference to FIG. 4.

In order to update the initial data, an initial data updating commandhaving a format shown in FIG. 5 is sent from external device 7 to CPU 4in IC card 1. This command consists of function code FC representingthat a change is to be made in initial data, and data DA to be updated.When CPU 4 in IC card 1 receives this command, data DA is written ataddress $0000 of data memory 3 (step ST101) and checks (step ST102)whether the data is properly written. If YES in step ST102, a responseindicating OK is generated (step ST103). Otherwise, a responseindicating a write error is generated (step ST104).

The generated response is output to external device 7 in accordance withprocessing result output processing (step ST12 or ST13 in case 1 andstep ST30 or ST31 in case 2). By using this command, for example, thecommunication protocol (A or B) supported by IC card 1 can be changedfrom external device 7 even in case 1.

As described above, IC card 1 of this embodiment can change thecommunication protocol from the side of external device 7 in accordancewith the specifications of external device 7 which performs datacommunication. Accurate data communication can be performed withexternal devices 7 having different types of communication protocol.Therefore, versatility of the IC card can be improved, and a systemusing an IC card can be flexibly arranged.

Selection or switching of a baud rate and/or a communication protocolcan be performed by external device 7. Even if a plurality of terminalshaving different communication protocols and baud rates are connected toeach other and data is exchanged therebetween, accurate datacommunication can be performed by switching to a proper communicationprotocol and a proper baud rate.

Assuming that a plurality of communication protocols can be supported(NO in steps ST1 in FIG. 2A; FIG. 2B), a priority order is given tothese plurality of protocols (A and B) and a communication protocol(e.g., A) having a higher priority can be selected by default. Forexample, if communication protocol A which is more frequently used has ahigher priority (i.e., protocol A has a higher priority if $0000=*0H instep ST4 of FIG. 2B), data communication can be automatically performedin communication protocol A, which is more frequently used, at the starttime of the system.

IC card 1 of this embodiment may support a plurality of protocols (A andB) or only one communication protocol (either A or B). Even if IC card 1is set to support only one communication protocol (YES in step ST1 ofFIG. 2A), the type of communication protocol (A or B) can be changed bythe procedures in FIG. 4. An IC card which is used for only one terminalcan be set to support only one communication protocol (e.g., onlyprotocol A) for this terminal.

In addition, various setup operations and changes can be very easilyperformed by only updating the content of address $0000 of data memory 3from external device 7 in accordance with the procedures in FIG. 3.

The number of types of communication protocols supported by an IC cardis not limited to two. An IC card can have three or more communicationprotocols, and these protocols can be appropriately selected and used.

The portable electronic apparatus of the present invention, as has beendescribed above, can automatically select a communication protocol (A)having the highest priority at the start time of the IC card under thecondition that a priority order (A>B) is set for a plurality ofcommunication protocols stored in storing means (2). For this reason,when data communication is performed using the communication protocol(A) having the highest priority, data communication can be startedsimultaneously when the system is started.

Additional advantages and modifications will readily occur to thoseskilled in the art. Therefore, the invention in its broader aspects isnot limited to the specific details, and representative devices shownand described herein. Accordingly, various modifications may be madewithout departing from the spirit or scope of the general inventiveconcept as defined by the appended claims and their equivalents.

What is claimed is:
 1. A portable electronic device connectable to anexternal device, said portable electronic device comprising:firststoring means for storing software programs respectively using differentcommunication protocols; second storing means for storing prescribedinformation, said prescribed information serving to discriminate aspecific protocol which is to be used when communication is started withsaid external device; third storing means, coupled with said first andsecond storing means, for storing said specific protocol whencommunication is started; communication means for communicating withsaid external device based on one of said software programs stored insaid first storing means, said software program corresponding to saidspecific protocol stored in said third storing means; and a controllerunit, coupled to said first and said second storing means as well assaid communication means and which incorporates said third storingmeans, for temporarily changing said specific protocol used by saidportable electronic device during communication in response to aprotocol type selection command input from said external device, wheresaid specific protocol is changed by modifying the stored contents ofsaid third storing means, and for changing said specific protocol usedby said portable electronic device at the time of start of communicationin response to an initial data updating command, where said specificprotocol for use at the time of start of communication is changed bymodifying the stored contents of said second storing means.
 2. Aportable electronic device according to claim 1, furthercomprising:means for updating the prescribed information stored in saidsecond storing means in accordance with a command delivered from theexternal device.
 3. A portable electronic device according to claim 1,wherein said second storing means includes:a first area for storingfirst prescribed information used to determine whether only one protocolis designated as said specific protocol; and a second area for storingsecond prescribed information used to check said one protocol when onlyone protocol is designated as said specific protocol.
 4. A portableelectronic device according to claim 1, wherein said controller unitincludes means for determining whether said specific protocol isdesignated by only one protocol and for generating a determining resultbased on that determination, where said determining result is made inaccordance with said prescribed information stored in said secondstoring means; andsaid communication means includes means for sendingdata representing each of said different communication protocols whichare to be used for the communication with said external device, wheresaid data is sent based on said determining result generated by saiddetermining means.
 5. A portable electronic device according to claim 4,wherein said second storing means includes:a third area for storingpriority order information with respect to a priority of each of saiddifferent communication protocols; and said communicating means includesmeans for sending said priority order information as well as saiddifferent communication protocols to said external device, in accordancewith said determining result provided by said determining means.
 6. Aportable electronic device according to claim 1, furthercomprising:means for determining that only one of said communicationprotocols is to be used for said communication performed by saidcommunication means.
 7. A system formed of portable electronic deviceseach optionally connected to an external device, each portableelectronic device comprising:first storing means for storing softwareprograms respectively using different communication protocols; secondstoring means for storing prescribed information serving to discriminatea specific protocol which is to be used by the portable electronicdevice at the time of start of a communication with the external device;third storing means, coupled with said first and second storing means,for storing said specific protocol when communication is started;communication means for communicating with said external device based onone of said software programs stored in said first storing means, saidsoftware program corresponding to said specific protocol stored in saidthird storing means; and a controller unit, coupled to said first andsaid second storing means as well as said communication means and whichincorporates said third storing means, for temporarily changing saidspecific protocol used by said portable electronic device duringcommunication in response to a protocol type selection command inputfrom said external device, where said specific protocol is changed bymodifying the stored contents of said third storing means, and forchanging said specific protocol used by said portable electronic deviceat the time of start of communication in response to an initial dataupdating command, where said specific protocol for use at the time ofstart of communication is changed modifying the stored contents of saidsecond storing means.
 8. A portable electronic device to be used with anexternal device, comprising:storing means for storing a plurality ofcommunication protocols to be used for a communication between saidportable electronic device and said external device, each protocolhaving a priority associated therewith; determining means, coupled withsaid storing means, for determining whether the portable electronicdevice supports at least two of the stored protocols, and providing adetermining result based on that determination for indicating whichprotocol will be used for said communication, thereby allowing a lowerpriority protocol to be used before a higher priority protocol;selecting means, coupled with said determination means, for selecting aprotocol based on said determining result; and means, coupled with saidselecting means, for communicating with said external device using saidselected protocol.
 9. A device according to claim 8, wherein saiddetermining means is provided with:means for specifying a predeterminedone of the communication protocols so as to supply the determinatingresult when the portable electronic device supports only one of thecommunication protocols.
 10. A device according to claim 9, furthercomprising:second storing means for storing information for specifyingthe predetermined one of the communication protocols.
 11. A deviceaccording to claim 10, further comprising:means for updating thespecifying information stored in said second storing means.
 12. A deviceaccording to claim 8, wherein said determining means is providedwith:means for setting an order of priorities of the plurality ofcommunication protocols, and supplying the determinating result in asequence from the communication protocol having a higher priority toother communication protocol having a lower priority when the portableelectronic device supports at least two of the plurality ofcommunication protocols.
 13. A device according to claim 12, whereinsaid determining means is provided with:means for providingcommunication protocols having the lower priority in place of thosehaving the higher priority as the determinating result.
 14. A deviceaccording to claim 12, further comprising:means for storing informationfor setting the order of priorities of the plurality of communicationprotocols.
 15. A device according to claim 14, further comprising meansfor updating the information for setting the order of priorities.
 16. Adevice according to claim 8, including an IC card, wherein the externaldevice includes a terminal for performing read/write access of data tosaid IC card.
 17. A portable electronic device comprising:storing meansfor storing a plurality of communication protocols; means forprioritizing said protocols including a first and subsequent prioritycorresponding to said stored protocols, said first and subsequentpriorities being changeable; means for selecting a protocol from saidstored protocols based on said priorities associated therewith; andmeans for performing communication using said selected protocol.